﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;

namespace Server.Common
{
    public static class ConfigUtil
    {
        private static Configuration GetConfiguration()
        {
            string configPath = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString() + ".config";

            if (!File.Exists(configPath)) throw new Exception("系统配置文件不存在");

            return ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = configPath }, ConfigurationUserLevel.None);
        }
        public static string GetAppSettings(string key)
        {
            return GetConfiguration().AppSettings.Settings["javaService"].Value;
        }
    }
}
